﻿using System;
using System.ServiceProcess;

namespace UrDnd.IrcBot.Service
{
	internal static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		private static void Main(string[] args)
		{
			var runInConsole = false;
			foreach (var arg in args)
				if (arg == "--console")
					runInConsole = true;

			if (runInConsole)
				RunConsole();
			else
				RunService();
		}

		private static void RunConsole()
		{
			new IrcBot().Launch(null);
		}

		private static void RunService()
		{
			var ServicesToRun = new ServiceBase[] {new IrcBotService()};

			ServiceBase.Run(ServicesToRun);
		}
	}
}
